package com.tang.param_check.aspect.log;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;
import java.time.Instant;


@Slf4j
@Aspect
@Component
public class LogWriteAspect {
    @Pointcut("execution(* com.tang..*.controller..*.*(..))")
    public void Pointcut() {
    }
    /**
     * @param point
     * @throws Exception
     */
    @Before("Pointcut()")
    public void beforeMethod(JoinPoint point) {
        MethodSignature signature = (MethodSignature) point.getSignature();
        Method method = signature.getMethod();
        log.info("用户：{}，时间：{}，方法：{}", "zhangsan", Instant.now(), method.getName());
    }
}